package cn.iocoder.yudao.module.ym.api.ymconnection;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.infra.api.site.SiteApi;
import cn.iocoder.yudao.module.infra.api.ymconnection.YmConnectionApi;
import cn.iocoder.yudao.module.infra.api.ymconnection.dto.ConnectionPageReqDto;
import cn.iocoder.yudao.module.infra.api.ymconnection.dto.ConnectionRespDto;
import cn.iocoder.yudao.module.infra.api.ymconnection.dto.ConnectionSaveReqDto;
import cn.iocoder.yudao.module.ym.controller.admin.connection.vo.ConnectionPageReqVO;
import cn.iocoder.yudao.module.ym.controller.admin.connection.vo.ConnectionRespVO;
import cn.iocoder.yudao.module.ym.controller.admin.connection.vo.ConnectionSaveReqVO;
import cn.iocoder.yudao.module.ym.service.connection.ConnectionService;
import cn.iocoder.yudao.module.ym.service.site.SiteService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 * Admin 用户 API 实现类
 *
 * @author 芋道源码
 */
@Service
public class YmConnectionApiImpl implements YmConnectionApi {

    @Resource
    private ConnectionService connectionService;


    @Override
    public Long createConnection(ConnectionSaveReqDto createReqVO) {
        return connectionService.createConnection(BeanUtils.toBean(createReqVO, ConnectionSaveReqVO.class));
    }

    @Override
    public Boolean insertBatch(List<ConnectionSaveReqDto> createReqVO) {
        return connectionService.insertBatch(BeanUtils.toBean(createReqVO, ConnectionSaveReqVO.class));
    }

    @Override
    public List<ConnectionRespDto> getConnectionList(ConnectionPageReqDto pageReqVO) {
        return BeanUtils.toBean(connectionService.getConnectionList(BeanUtils.toBean(pageReqVO, ConnectionPageReqVO.class)), ConnectionRespDto.class);
    }

    @Override
    public Integer deleteByUserId(Long userId) {
        return connectionService.deleteByUserId(userId);
    }

    @Override
    public Set<Long> getUserAreaIdListByAreaId(Collection<Long> areaIds) {
        return connectionService.getUserAreaIdListByAreaId(areaIds);
    }
}
